﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace IWMAG.Core.Objects {
    public class CollisionHandlerObject : GameObject {
        public override void Load(int id, Level level) {
            level.Collisions = this;

            base.Load(id, level);
        }

        public override void ReceiveMessage(Messaging.Message msg) {
            base.ReceiveMessage(msg);
        }

        public IHitbox SolidCollision(IHitbox hitbox) {
            foreach (IHitbox box in Level.Solids) {
                if (box.CollidesWith(hitbox)) {
                    return box;
                }
            }

            return null;
        }

        public bool SolidCollision(Vector2 point) {
            foreach (IHitbox box in Level.Solids) {
                if (box.Contains(point)) {
                    return true;
                }
            }

            return false;
        }
    }
}
